package handler;

import java.io.File;
import java.io.FilenameFilter;

/**
 * Class allowing to filter some files
 * @author jean
 *
 */
public class FileFilter implements FilenameFilter {
	
	/**
	 * Filter mp3 file
	 * @param dir	Directory files from
	 * @param name	filename
	 */
	public boolean accept(File dir, String name) {
		File f = new File(dir.getPath() + "/" + name);
		if(name.startsWith(".")) return false;
		else if(f.isDirectory()) return true;
		else if(!(name.endsWith(".mp3") || name.endsWith(".MP3"))) return false;
		else return true;
	}
}
